#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<cstdio>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define ll long long
#define pi acos(-1)
const int maxn = 1e6+5;


char s[maxn];  //题目输入的字符串 
int len;   //字符串长度 
int m;   //题目输入 
int pos;

/*--------单哈希--------*/
ll base = 29;
ll mod = 1e9+7;
ll hhash[maxn],p[maxn];

inline void init()   //计算字符串的哈希值 
{
	hhash[0] = 0;
	p[0] = 1;
	
	for(int i=1;i<=len;++i)
		hhash[i] = (hhash[i-1]*base+s[i]-'a'+1)%mod;
	
	for(int i=1;i<=len;++i)
		p[i] = (p[i-1]*base)%mod;

}

inline ll gethash(int l,int r)  //返回区间[l, r]的哈希值 
{
	ll res = ((hhash[r]-hhash[l-1]*p[r-l+1])%mod+mod)%mod;
	return res;
}


struct node
{
	ll h;
	int px;
}e[maxn];

bool cmp(const node &a,const node &b)
{
	if(a.h==b.h) return a.px<b.px;
	
	return a.h<b.h;
}

int book(int x)
{
	
	pos = -1;   //记录题目的第二个输出 
	
	if(m==1)  //只出现1次的子串，那就是字符串本身，直接输出就行 
	{
		pos = 1;
		return 1;
	}
	int k = 0;
	
	for(int i=len-x+1;i>=1;--i)
	{
		e[k].h = gethash(i,i+x-1);  //处理所有长度为x的子串 
		e[k++].px = i;
	}
	
	sort(e,e+k,cmp);
	
	int cnt = 1;

	for(int i=1;i<k;++i)
	{
		if(e[i].h==e[i-1].h)
		{
			++cnt;
			if(cnt>=m) pos = max(pos,e[i].px);
		}
		else cnt = 1;
	}
	
	return pos!=-1;
}
signed main()
{
	while(~scanf("%d",&m)&&m)
	{
		scanf("%s",s+1);
		len = strlen(s+1);
		init();
		
		int l = 1,r = len;
		int ans1 = -1;
		int ans2;
		
		//二分子串长度，找出满足要求的即可 
		while(l<=r)
		{
			int mid = (l+r)>>1;
			if(book(mid))
			{
				ans1 = mid;
				ans2 = pos;
				l = mid + 1;
			}
			else r = mid - 1;
		}
		
		//注意输出ans2时要减1，因为我们的字符串从1开始存的 
		if(ans1==-1) puts("none");
		else printf("%d %d\n",ans1,ans2-1); 
	}
	return 0;
}
